package com.quanyan.stadium.component.task;

import com.quanyan.stadium.constants.DatesportConstants;
import com.quanyan.stadium.mapper.DatesportMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;

import java.util.Date;

/**
 * Created by Zheng.Ke
 * Date 2016/7/21.
 */
//@Component
public class DatesportTask {

    private static Logger logger = LoggerFactory.getLogger(DatesportTask.class);

    @Autowired
    private DatesportMapper datesportMapper;

    /**
     * 邀请次数每天凌晨恢复
     */
    @Scheduled(cron = "0 0 0 * * ?")
    public void clearExpireOrder() {
        logger.info("约运动开始更新邀请次数。");
        datesportMapper.updateInviteCount(DatesportConstants.MAX_INVITE_CNT, new Date());
        logger.info("约运动更新邀请次数结束。");
    }
    
}
